using System;
using System.Collections.Generic;


namespace DataObjects
{
	[Serializable]
	public class Permission: IEquatable<Permission>
	{

		#region Private Members

		private string _group_id; 
		private string _form_name; 
		private bool? _func_add; 
		private bool? _func_edit; 
		private bool? _func_delete; 
		private bool? _func_cancel; 
		private bool? _func_save; 
		private bool? _func_more; 
		private bool? _func_view; 
		private bool? _func_find; 
		private bool? _func_export; 
		private bool? _func_sendmail; 
		private bool? _func_print; 		
		#endregion

		#region Constructor

		public Permission()
		{
			_group_id = String.Empty; 
			_form_name = String.Empty; 
			_func_add = new bool?(); 
			_func_edit = new bool?(); 
			_func_delete = new bool?(); 
			_func_cancel = new bool?(); 
			_func_save = new bool?(); 
			_func_more = new bool?(); 
			_func_view = new bool?(); 
			_func_find = new bool?(); 
			_func_export = new bool?(); 
			_func_sendmail = new bool?(); 
			_func_print = new bool?(); 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public Permission(
			string group_id, 
			string form_name)
			: this()
		{
			_group_id = group_id;
			_form_name = form_name;
			_func_add = null;
			_func_edit = null;
			_func_delete = null;
			_func_cancel = null;
			_func_save = null;
			_func_more = null;
			_func_view = null;
			_func_find = null;
			_func_export = null;
			_func_sendmail = null;
			_func_print = null;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string GroupId
		{
			get
			{ 
				return _group_id;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for GroupId", value, "null");
				
				if(  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for GroupId", value, value.ToString());
				
				_group_id = value;
			}
		}
			
		public virtual string FormName
		{
			get
			{ 
				return _form_name;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for FormName", value, "null");
				
				if(  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for FormName", value, value.ToString());
				
				_form_name = value;
			}
		}
			
		public virtual bool? FuncAdd
		{
			get
			{ 
				return _func_add;
			}
			set
			{
				_func_add = value;
			}

		}
			
		public virtual bool? FuncEdit
		{
			get
			{ 
				return _func_edit;
			}
			set
			{
				_func_edit = value;
			}

		}
			
		public virtual bool? FuncDelete
		{
			get
			{ 
				return _func_delete;
			}
			set
			{
				_func_delete = value;
			}

		}
			
		public virtual bool? FuncCancel
		{
			get
			{ 
				return _func_cancel;
			}
			set
			{
				_func_cancel = value;
			}

		}
			
		public virtual bool? FuncSave
		{
			get
			{ 
				return _func_save;
			}
			set
			{
				_func_save = value;
			}

		}
			
		public virtual bool? FuncMore
		{
			get
			{ 
				return _func_more;
			}
			set
			{
				_func_more = value;
			}

		}
			
		public virtual bool? FuncView
		{
			get
			{ 
				return _func_view;
			}
			set
			{
				_func_view = value;
			}

		}
			
		public virtual bool? FuncFind
		{
			get
			{ 
				return _func_find;
			}
			set
			{
				_func_find = value;
			}

		}
			
		public virtual bool? FuncExport
		{
			get
			{ 
				return _func_export;
			}
			set
			{
				_func_export = value;
			}

		}
			
		public virtual bool? FuncSendmail
		{
			get
			{ 
				return _func_sendmail;
			}
			set
			{
				_func_sendmail = value;
			}

		}
			
		public virtual bool? FuncPrint
		{
			get
			{ 
				return _func_print;
			}
			set
			{
				_func_print = value;
			}

		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Permission castObj = (Permission)obj; 
			return ( castObj != null ) &&
				( this._group_id == castObj.GroupId ) &&
				( this._form_name == castObj.FormName );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _group_id.GetHashCode();
			hash = 27 ^ hash ^ _form_name.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(Permission other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._group_id == other.GroupId ) &&
				( this._form_name == other.FormName );
				   
		}

		#endregion
		
	}
}
